class Solution(object):
    def removeElement(self, nums, val):
        """
        :type nums: List[int]
        :type val: int
        :rtype: int
        """
        count = 0
        while count <= len(nums)-1:
            if nums[count] == val:
                nums[count] = nums[len(nums)-1]
                nums.pop(len(nums)-1)
            else:
                count+=1
        return len(nums)



a = [3,2,2,3]
s = Solution()
h= s.removeElement(a,2)
print(h)